﻿using Microsoft.Extensions.DependencyInjection;

using System.Globalization;


namespace Core.Infrastructures._118N
{
    public partial class Initialize
    {
        /// <summary>
        /// 配置可选语言
        /// </summary>
        private static readonly CultureInfo[] SupportedCultures = new[]
        {
                new CultureInfo("en-US"),
                new CultureInfo("zh-CN")
        };

        /// <summary>
        /// 设置语言信息
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        //private static RequestLocalizationOptions SetLanguageInfo(RequestLocalizationOptions options = default)
        //{
        //    if (options == null) options = new RequestLocalizationOptions();

        //    options.DefaultRequestCulture = new RequestCulture("zh-CN");    // 设置默认语言
        //    options.SupportedCultures = SupportedCultures;
        //    options.SupportedUICultures = SupportedCultures;

        //    return options;
        //}
        public static void ConfigureServices(IServiceCollection services)
        {
            //services.AddLocalization(options => options.ResourcesPath = "Resources");   // 设置资源文件目录
            //services.Configure<RequestLocalizationOptions>(options => SetLanguageInfo(options));
        }

        //public static void Configure(IApplicationBuilder app) => app.UseRequestLocalization(SetLanguageInfo());
    }
}
